package leetcode.easy.q168;

class Solution {

    public String convertToTitle(int columnNumber) {
        StringBuilder stringBuilder = new StringBuilder();
        while (columnNumber > 0) {
            int mod = columnNumber % 26;
            if (mod == 0) {
                mod = 26;
            }
            stringBuilder.append((char) (mod + 64));
            columnNumber = (columnNumber - mod) / 26;
        }
        return stringBuilder.reverse().toString();
    }

    public static void main(String[] args) {
        System.out.println(new Solution().convertToTitle(701));

        String a="AZ";
//        'A'*26+'Z'*1=m

    }
}